import os
import pytest
from loguru import logger
from utils.basic_utils import get_path


if __name__ == '__main__':

    # 1. 生成日志文件
    logger.add(get_path('logs','litemall.log'),level='DEBUG',rotation='5Mb')

    # 2. 通过pytest运行测试用例，
    test_data = 'result'
    test_report = 'report'
    lst = ['cases','--alluredir',test_data]
    pytest.main(lst)

    # 3. 通过allure生成报告
    cmd = "allure generate {} -o {} -c".format(test_data,test_report)
    os.system(cmd)
